#!/bin/bash

if [ ! -f "LICENSE" ]; then
    echo "must run from root of rez project" 1>&2
    exit 1
fi

# remove copyright
find ./src/rez/data -name '*.py' > .lic.tmp
find ./src/rez/backport -name '*.py' >> .lic.tmp
cat .lic.tmp | xargs -i ./src/build_utils/license/change_copyright -so {}

# add copyright
find ./src/rez/bind -name '*.py' > .lic.tmp
find ./src/rez/cli -name '*.py' >> .lic.tmp
find ./src/rez/tests -name '*.py' >> .lic.tmp
find ./src/rez/utils -name '*.py' >> .lic.tmp
find ./src/rez/vendor/version -name '*.py' >> .lic.tmp
find ./src/rez/bind -name '*.py' >> .lic.tmp
find ./src/rezgui -name '*.py' >> .lic.tmp
find ./src/rezplugins -name '*.py' >> .lic.tmp
find ./src/support -name '*.py' >> .lic.tmp
find ./src/rez -maxdepth 1 -name '*.py' >> .lic.tmp
find ./ -maxdepth 1 -name '*.py' >> .lic.tmp
find ./example_extensions -name '*.py' >> .lic.tmp
find ./src/rezplugins/build_system/cmake_files -name '*.cmake' >> .lic.tmp
cat .lic.tmp | xargs -i ./src/build_utils/license/change_copyright -o {}

rm -f .lic.tmp
